package brouter.api;

import android.app.Activity;

import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;

public class ParameterManager {
    private static final String TAG = "ParameterManager";

    public static void bind(Activity activity) {
        String name = activity.getClass().getName();
        try {
            Class<?> clazz = Class.forName(name + "$$Parameter");
            Method bind = clazz.getMethod("inject", activity.getClass());
            bind.invoke(clazz.newInstance(), activity);
        } catch (ClassNotFoundException | IllegalAccessException | InstantiationException | InvocationTargetException | NoSuchMethodException e) {
            e.printStackTrace();
        }
    }
}
